zds-pickers 4.0.8 → 4.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/index.cjs.js +12 -12
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +1265 -1890
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/types/midi/export.d.ts +8 -9
  6. package/dist/types/pickers/StatusPicker.d.ts +2 -2
  7. package/lib/hooks/useComponentSize.js +40 -0
  8. package/lib/hooks/useStateWithDynamicDefault.js +9 -0
  9. package/lib/index.js +21 -0
  10. package/lib/midi/ccValues.js +134 -0
  11. package/lib/midi/export.js +27 -0
  12. package/lib/midi/export.ts +2 -3
  13. package/lib/other/DefaultTooltip.js +3 -0
  14. package/lib/other/OctavePlayer.js +48 -0
  15. package/lib/other/SVGText.js +109 -0
  16. package/lib/other/SoundFontProvider.js +87 -0
  17. package/lib/pickers/CCPicker.js +6 -0
  18. package/lib/pickers/ChannelMappingPicker.js +50 -0
  19. package/lib/pickers/ChannelPicker.js +21 -0
  20. package/lib/pickers/Knob.js +49 -0
  21. package/lib/pickers/KnobPicker.js +29 -0
  22. package/lib/pickers/LatchPicker.js +9 -0
  23. package/lib/pickers/MappingPicker.js +37 -0
  24. package/lib/pickers/NotePicker.js +45 -0
  25. package/lib/pickers/PianoPicker.js +27 -0
  26. package/lib/pickers/PolarityPicker.js +11 -0
  27. package/lib/pickers/ResponseCurve.js +154 -0
  28. package/lib/pickers/ResponseCurvePicker.js +19 -0
  29. package/lib/pickers/Select.js +79 -0
  30. package/lib/pickers/StatusPicker.js +5 -0
  31. package/lib/pickers/ValuePicker.js +23 -0
  32. package/lib/pickers/knobSkin10.js +93 -0
  33. package/lib/rotaryKnob/InternalInput.js +22 -0
  34. package/lib/rotaryKnob/Types.js +1 -0
  35. package/lib/rotaryKnob/helpers/DrawCircle.js +9 -0
  36. package/lib/rotaryKnob/helpers/DrawLine.js +9 -0
  37. package/lib/rotaryKnob/helpers/HelpersOverlay.js +26 -0
  38. package/lib/rotaryKnob/helpers/KnobVisualHelpers.js +52 -0
  39. package/lib/rotaryKnob/index.js +244 -0
  40. package/lib/rotaryKnob/knobdefaultskin.js +56 -0
  41. package/lib/rotaryKnob/utils.js +106 -0
  42. package/lib/utils.js +21 -0
  43. package/package.json +2 -3
  44. package/tsconfig.json +1 -1
  45. package/vite.config.ts +3 -19
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useMemo } from 'react';
3
+ import { arraySequence } from '../utils';
4
+ import Knob from './Knob';
5
+ import Select from './Select';
6
+ const KnobPicker = forwardRef((props, ref) => {
7
+ const { disabled, highToLow, includeLabel, includePicker, knobProps, label, max = 127, min = 0, onChange, shrinkLabel, value = 0, wheelEnabled, wheelSensitivity = 0.1, ...rest } = props;
8
+ const options = useMemo(() => {
9
+ const result = arraySequence(max - min + 1)
10
+ .map(i => min + i)
11
+ .map((i) => ({ value: i, label: String(i) }));
12
+ return highToLow ? result.reverse() : result;
13
+ }, [highToLow, max, min]);
14
+ return (_jsxs("div", { className: "zds-pickers__container", children: [Boolean(!shrinkLabel && Boolean(label)) && (_jsx("span", { className: "zds-pickers__label", children: label })), _jsxs("div", { style: { display: 'inline-flex', gap: 10, alignItems: 'center' }, children: [Boolean(includePicker) && (_jsx(Select, { ...rest,
15
+ disabled,
16
+ isDisabled: disabled,
17
+ onChange,
18
+ options,
19
+ ref,
20
+ value })), _jsx(Knob, { disabled,
21
+ max,
22
+ min,
23
+ onChange,
24
+ value,
25
+ wheelEnabled,
26
+ wheelSensitivity,
27
+ ...knobProps })] })] }));
28
+ });
29
+ export default KnobPicker;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import Select from './Select';
4
+ const options = [
5
+ { value: 0, label: 'Momentary' },
6
+ { value: 1, label: 'Latching' },
7
+ ];
8
+ const LatchPicker = forwardRef((props, ref) => (_jsx(Select, { ...props, options: options, ref: ref })));
9
+ export default LatchPicker;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useMemo } from 'react';
3
+ import { getStockNames, getUserMappingNames } from 'zds-mappings';
4
+ import Select from './Select';
5
+ const MappingPicker = forwardRef(({ allowClearing, ...rest }, ref) => {
6
+ const stockMappings = getStockNames();
7
+ const userMappings = getUserMappingNames();
8
+ const options = useMemo(() => {
9
+ const result = allowClearing
10
+ ? [
11
+ {
12
+ value: 'No Mapping',
13
+ label: (_jsx("span", { className: "zds-mappings-clear-mapping", children: "No Mapping" })),
14
+ },
15
+ ]
16
+ : [];
17
+ return [
18
+ ...result,
19
+ {
20
+ label: allowClearing ? _jsx("hr", {}) : '',
21
+ options: userMappings.map(label => ({
22
+ value: label,
23
+ label: _jsx("span", { className: "zds-mappings-user-mapping", children: label }),
24
+ })),
25
+ },
26
+ {
27
+ label: userMappings.length ? _jsx("hr", {}) : allowClearing ? _jsx("hr", {}) : '',
28
+ options: stockMappings.map(label => ({
29
+ label,
30
+ value: label,
31
+ })),
32
+ },
33
+ ];
34
+ }, [allowClearing, stockMappings, userMappings]);
35
+ return (_jsx(Select, { ...rest, options: options, ref: ref }));
36
+ });
37
+ export default MappingPicker;
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useCallback, useMemo } from 'react';
3
+ import { Midi } from 'tonal';
4
+ import { emptyMapping } from 'zds-mappings';
5
+ import useStateWithDynamicDefault from '../hooks/useStateWithDynamicDefault';
6
+ import { assertRange } from '../utils';
7
+ import Select from './Select';
8
+ const { midiToNoteName } = Midi;
9
+ const formattedMapEntry = ({ note, name }) => `${note} ${name.length ? '-' : ''} ${name}`;
10
+ const formattedListEntry = (label, idx) => ({
11
+ label,
12
+ value: idx + 1,
13
+ });
14
+ const NotePicker = forwardRef((props, ref) => {
15
+ const { channel, disabled = false, isMelodicMode = false, mapping, onChange, value: initialValue, ...rest } = props;
16
+ const options = useMemo(() => {
17
+ if (isMelodicMode) {
18
+ return emptyMapping()
19
+ .map(({ note }) => {
20
+ const midiNoteName = midiToNoteName(note, { sharps: false })
21
+ .replace('b', '♭')
22
+ .replace('#', '♯');
23
+ return `${midiNoteName} (#${note})`;
24
+ })
25
+ .map(formattedListEntry);
26
+ }
27
+ return (mapping || emptyMapping())
28
+ .map(formattedMapEntry)
29
+ .map(formattedListEntry);
30
+ }, [isMelodicMode, mapping]);
31
+ const [value, setValue] = useStateWithDynamicDefault(initialValue);
32
+ const handleChange = useCallback((v) => {
33
+ if (typeof v === 'string')
34
+ return;
35
+ const possibleNoteNumber = assertRange(v, 128, 0);
36
+ if (possibleNoteNumber > 0) {
37
+ onChange(possibleNoteNumber);
38
+ }
39
+ setValue(v);
40
+ }, [onChange, setValue]);
41
+ return (_jsx(Select, { ...rest, disabled: disabled,
42
+ // isDisabled={disabled}
43
+ onChange: handleChange, options: options, ref: ref, value: value }));
44
+ });
45
+ export default NotePicker;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Piano as ReactPiano } from 'zds-react-piano';
3
+ import SoundfontProvider from '../other/SoundFontProvider';
4
+ const firstNote = 21;
5
+ const lastNote = 108;
6
+ const numNotes = lastNote - firstNote - 1;
7
+ const whiteNotes = numNotes * 0.7; // approx
8
+ const audioContext = new window.AudioContext();
9
+ const PianoPicker = ({ height, width, ...rest }) => {
10
+ const keyWidth = width / whiteNotes + 2;
11
+ const keyWidthToHeight = keyWidth / height;
12
+ return (_jsx("div", { children: _jsx(ReactPiano, { keyWidthToHeight: keyWidthToHeight, noteRange: { first: firstNote, last: lastNote }, width: width, ...rest }) }));
13
+ };
14
+ const WithProvider = ({ format, height, hostname, instrumentName, onChange, onClick, onDoubleClick, onKeyMouseEnter, onKeyMouseLeave, soundfont, width, }) => (_jsx(SoundfontProvider, { audioContext,
15
+ format,
16
+ hostname,
17
+ instrumentName,
18
+ onChange,
19
+ soundfont, render: ({ isLoading, playNote, stopNote }) => (_jsx(PianoPicker, { disabled: isLoading, height,
20
+ onClick,
21
+ onDoubleClick,
22
+ onKeyMouseEnter,
23
+ onKeyMouseLeave,
24
+ playNote,
25
+ stopNote,
26
+ width })) }));
27
+ export default WithProvider;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import Select from './Select';
4
+ const PolarityPicker = forwardRef(({ labelOff = 'Normally Off', labelOn = 'Normally On', ...rest }, ref) => {
5
+ const options = [
6
+ { value: 0, label: labelOff },
7
+ { value: 1, label: labelOn },
8
+ ];
9
+ return (_jsx(Select, { ...rest, options: options, ref: ref }));
10
+ });
11
+ export default PolarityPicker;
@@ -0,0 +1,154 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef } from 'react';
3
+ import useComponentSize from '../hooks/useComponentSize';
4
+ import DefaultTooltip from '../other/DefaultTooltip';
5
+ import SVGText from '../other/SVGText';
6
+ const RESPONSE_CURVE_0 = 0;
7
+ const RESPONSE_CURVE_1 = 1;
8
+ const RESPONSE_CURVE_2 = 2;
9
+ const RESPONSE_CURVE_3 = 3;
10
+ const RESPONSE_CURVE_4 = 4;
11
+ const RESPONSE_CURVE_5 = 5;
12
+ const RESPONSE_CURVE_6 = 6;
13
+ const RESPONSE_CURVE_7 = 7;
14
+ const RESPONSE_CURVES = [
15
+ {
16
+ value: RESPONSE_CURVE_7,
17
+ label: 'Always maxed out.',
18
+ },
19
+ {
20
+ value: RESPONSE_CURVE_6,
21
+ label: 'Most sensitive.',
22
+ },
23
+ {
24
+ value: RESPONSE_CURVE_5,
25
+ label: 'Moderately sensitive.',
26
+ },
27
+ {
28
+ value: RESPONSE_CURVE_4,
29
+ label: 'A little sensitive.',
30
+ },
31
+ {
32
+ value: RESPONSE_CURVE_0,
33
+ label: 'Linear, no change.',
34
+ },
35
+ {
36
+ value: RESPONSE_CURVE_1,
37
+ label: 'A little less sensitive.',
38
+ },
39
+ {
40
+ value: RESPONSE_CURVE_2,
41
+ label: 'Even less sensitive.',
42
+ },
43
+ {
44
+ value: RESPONSE_CURVE_3,
45
+ label: 'Least sensitive.',
46
+ },
47
+ ];
48
+ // const width = 218
49
+ // const height = 150
50
+ const axisOffset = 20;
51
+ const buttonSize = 15;
52
+ const axisX1 = axisOffset;
53
+ const axisY1 = axisOffset;
54
+ const ResponseCurve = (props) => {
55
+ const { Tooltip = DefaultTooltip, autosize, disabled, inverted, onChange, value: responseCurve, } = props;
56
+ const ref = useRef(null);
57
+ const svgRef = useRef(null);
58
+ const { height: ourHeight, width: ourWidth } = useComponentSize(ref);
59
+ const width = autosize ? ourWidth || 218 : 218;
60
+ const height = autosize ? ourHeight || 150 : 150;
61
+ const axisX2 = width - axisOffset;
62
+ const axisY2 = height - axisOffset;
63
+ const xMid = width / 2;
64
+ const yMid = height / 2;
65
+ const svgProps = { ref: svgRef };
66
+ const responseCurves = RESPONSE_CURVES.map(
67
+ // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
68
+ ({ value, label }) => {
69
+ let c1 = 0;
70
+ let c2 = 0;
71
+ let x1 = axisX1;
72
+ let y1 = inverted ? axisY1 : axisY2;
73
+ let x2 = axisX2;
74
+ let y2 = inverted ? axisY2 : axisY1;
75
+ let labelX = xMid;
76
+ let labelY = yMid;
77
+ switch (value) {
78
+ case RESPONSE_CURVE_0:
79
+ c1 = xMid;
80
+ c2 = yMid;
81
+ labelY += 3;
82
+ break;
83
+ case RESPONSE_CURVE_1:
84
+ c1 = inverted ? xMid + width * 0.13 : xMid - width * 0.13;
85
+ c2 = yMid - height * 0.13;
86
+ labelX = inverted ? xMid + width * 0.1 : xMid - width * 0.1;
87
+ labelY = yMid - height * 0.09;
88
+ break;
89
+ case RESPONSE_CURVE_2:
90
+ c1 = inverted ? xMid + width * 0.25 : xMid - width * 0.25;
91
+ c2 = yMid - height * 0.25;
92
+ labelX = inverted ? xMid + width * 0.2 : xMid - width * 0.2;
93
+ labelY = yMid - height * 0.17;
94
+ break;
95
+ case RESPONSE_CURVE_3:
96
+ c1 = inverted ? xMid + width * 0.35 : xMid - width * 0.35;
97
+ c2 = yMid - height * 0.35;
98
+ labelX = inverted ? xMid + width * 0.28 : xMid - width * 0.28;
99
+ labelY = yMid - height * 0.25;
100
+ break;
101
+ case RESPONSE_CURVE_4:
102
+ c1 = inverted ? xMid - width * 0.13 : xMid + width * 0.13;
103
+ c2 = yMid + height * 0.13;
104
+ labelX = inverted ? xMid - width * 0.1 : xMid + width * 0.1;
105
+ labelY = yMid + height * 0.1;
106
+ break;
107
+ case RESPONSE_CURVE_5:
108
+ c1 = inverted ? xMid - width * 0.25 : xMid + width * 0.25;
109
+ c2 = yMid + height * 0.25;
110
+ labelX = inverted ? xMid - width * 0.2 : xMid + width * 0.2;
111
+ labelY = yMid + height * 0.18;
112
+ break;
113
+ case RESPONSE_CURVE_6:
114
+ c1 = inverted ? xMid - width * 0.35 : xMid + width * 0.35;
115
+ c2 = yMid + height * 0.35;
116
+ labelX = inverted ? xMid - width * 0.28 : xMid + width * 0.28;
117
+ labelY = yMid + height * 0.25;
118
+ break;
119
+ case RESPONSE_CURVE_7:
120
+ x1 = inverted ? axisX1 : axisX2;
121
+ y1 = axisY1;
122
+ x2 = x1;
123
+ y2 = axisY2;
124
+ c1 = x1;
125
+ c2 = yMid;
126
+ labelX = x1 - 5;
127
+ labelY = height - 30;
128
+ break;
129
+ default:
130
+ break;
131
+ }
132
+ return {
133
+ value,
134
+ label,
135
+ c1,
136
+ c2,
137
+ x1,
138
+ y1,
139
+ x2,
140
+ y2,
141
+ labelX,
142
+ labelY,
143
+ };
144
+ });
145
+ return (_jsx("div", { className: "response-curve-picker", ref: ref, children: _jsxs("svg", { ...svgProps, children: [_jsx("rect", { className: "container", height: height, rx: 3, ry: 3, width: width, x: 0, y: 0 }), _jsx(SVGText, { className: "axis", textAnchor: "middle", transform: `translate(${axisX1 - 14} ${height / 2}) rotate(90)`, x: 0, y: 0, text: "Applied force" }), _jsx(SVGText, { className: "axis", textAnchor: "middle", transform: `translate(${width / 2} ${axisY2 + 13})`, x: 0, y: 0, text: "Output (velocity)" }), _jsx("line", { className: "axis", x1: axisX1, x2: axisX1, y1: axisY1, y2: axisY2 }), _jsx("line", { className: "axis", x1: axisX1, x2: axisX2, y1: axisY2, y2: axisY2 }), responseCurves.map(({ value, label, x1, y1, x2, y2, c1, c2, labelX, labelY }) => (_jsxs("g", { children: [_jsx("path", { className: value === responseCurve ? 'curve-selected' : 'curve', d: `M${x1} ${y1} C ${c1} ${c2}, ${c1} ${c2}, ${x2} ${y2}` }), _jsx(Tooltip, { placement: "left", title: label, children: _jsx("rect", { className: value === responseCurve ? 'button-selected' : 'button', height: buttonSize, onClick: disabled
146
+ ? f => f
147
+ : () => onChange({
148
+ target: {
149
+ value: Number.parseInt(String(value)),
150
+ },
151
+ }), transform: `translate(${labelX + 3} ${labelY - buttonSize / 1.05}) rotate(45)`, width: buttonSize }) }), _jsxs("text", { className: value === responseCurve ? 'button-selected' : 'button', transform: `translate(${labelX} ${labelY})`, children: [value, _jsx("title", { children: label })] })] }, value)))] }) }));
152
+ };
153
+ export default ResponseCurve;
154
+ export { RESPONSE_CURVES };
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useCallback } from 'react';
3
+ import DefaultTooltip from '../other/DefaultTooltip';
4
+ import { findObj } from '../utils';
5
+ import ResponseCurve, { RESPONSE_CURVES } from './ResponseCurve';
6
+ import Select from './Select';
7
+ const ResponseCurvePicker = forwardRef((props, ref) => {
8
+ const { Tooltip = DefaultTooltip, inverted = false, onChange, value, ...rest } = props;
9
+ const Placeholder = useCallback(() => (_jsx("div", { className: "singleValue", children: findObj('value', value)(RESPONSE_CURVES)?.label })), [value]);
10
+ const MenuList = useCallback(({ setValue }) => (_jsx(ResponseCurve, { autosize: true, inverted: inverted, onChange: ({ target: { value: v } }) => {
11
+ setValue(v);
12
+ onChange(v);
13
+ }, Tooltip: Tooltip, value: Number.parseInt(String(value)) })), [Tooltip, inverted, onChange, value]);
14
+ return (_jsx(Select, { ...rest, components: {
15
+ Placeholder,
16
+ MenuList,
17
+ }, isSearchable: false, onChange: f => f, ref: ref, value: value }));
18
+ });
19
+ export default ResponseCurvePicker;
@@ -0,0 +1,79 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Children, forwardRef, isValidElement, useCallback, useMemo, } from 'react';
3
+ import ReactSelect, { components as originalComponents, } from 'react-select';
4
+ import { omit } from '../utils';
5
+ const { IndicatorsContainer, Placeholder, ValueContainer } = originalComponents;
6
+ const CustomIndicatorsContainer = ({ children, ...rest }) => {
7
+ const actionButton = rest.selectProps?.actionButton;
8
+ return (_jsx(IndicatorsContainer, { ...rest, children: _jsxs("div", { onMouseDown: e => {
9
+ e.stopPropagation();
10
+ e.preventDefault();
11
+ }, style: { display: 'flex' }, children: [actionButton, children] }) }));
12
+ };
13
+ const CustomValueContainer = ({ children, ...props }) => (_jsxs(ValueContainer, { ...props, children: [_jsx(Placeholder, { ...props, innerProps: props.innerProps || {}, className: props.hasValue || props.selectProps.inputValue ? 'shrunk' : '', isFocused: props.isFocused ?? false, children: props.selectProps.placeholder }), Children.map(children, child => isValidElement(child) && child.type !== Placeholder ? child : null)] }));
14
+ const Select = forwardRef((props, ref) => {
15
+ const { components, disabled, label, onChange, options = [], preserveMenuWidth, shrinkLabel, value, ...rest } = props;
16
+ const handleChange = useCallback((option) => {
17
+ if (option) {
18
+ onChange(option.value);
19
+ }
20
+ }, [onChange]);
21
+ const flatOptionsList = options.reduce((acc, entry) => {
22
+ if ('entries' in entry) {
23
+ return acc.concat(entry.entries);
24
+ }
25
+ return acc.concat(entry);
26
+ }, []);
27
+ const selectedOption = flatOptionsList.find(option => value === option.value) || undefined;
28
+ const styles = useMemo(() => {
29
+ const base = preserveMenuWidth
30
+ ? {
31
+ menu: (base) => omit('width')(base),
32
+ menuList: (base) => ({
33
+ ...base,
34
+ overflowX: 'hidden',
35
+ }),
36
+ option: (base) => ({
37
+ ...base,
38
+ whiteSpace: 'nowrap',
39
+ paddingRight: 10,
40
+ }),
41
+ }
42
+ : {};
43
+ return shrinkLabel
44
+ ? {
45
+ ...base,
46
+ container: (provided /* , state */) => ({
47
+ ...provided,
48
+ marginTop: 10,
49
+ }),
50
+ placeholder: (_provided, state) => ({
51
+ position: 'absolute',
52
+ left: state.hasValue || state.selectProps.inputValue ? -2 : '4%',
53
+ top: state.hasValue || state.selectProps.inputValue ? -12 : '50%',
54
+ transition: 'top 0.1s, font-size 0.1s, color 0.1s',
55
+ fontSize: (state.hasValue || state.selectProps.inputValue) && 13,
56
+ }),
57
+ valueContainer: (provided /* , state */) => ({
58
+ ...provided,
59
+ overflow: 'visible',
60
+ }),
61
+ }
62
+ : {
63
+ ...base,
64
+ };
65
+ }, [preserveMenuWidth, shrinkLabel]);
66
+ return shrinkLabel ? (_jsx("div", { className: "zds-pickers__container", children: _jsx(ReactSelect, { ...rest, classNamePrefix: "zds-pickers", components: {
67
+ IndicatorsContainer: CustomIndicatorsContainer,
68
+ ValueContainer: CustomValueContainer,
69
+ ...components,
70
+ }, isDisabled: disabled, onChange: handleChange, options: flatOptionsList, placeholder: label,
71
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
72
+ ref: ref, styles: styles, value: selectedOption }) })) : (_jsxs("div", { className: "zds-pickers__container", children: [Boolean(label) && _jsx("span", { className: "zds-pickers__label", children: label }), _jsx(ReactSelect, { ...rest, classNamePrefix: "zds-pickers", components: {
73
+ IndicatorsContainer: CustomIndicatorsContainer,
74
+ ...components,
75
+ }, isDisabled: disabled, onChange: handleChange, options: flatOptionsList,
76
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
77
+ ref: ref, styles: styles, value: selectedOption })] }));
78
+ });
79
+ export default Select;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import Select from './Select';
4
+ const StatusPicker = forwardRef(({ statuses, ...rest }, ref) => (_jsx(Select, { ...rest, options: statuses, ref: ref })));
5
+ export default StatusPicker;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useCallback, useMemo } from 'react';
3
+ import useStateWithDynamicDefault from '../hooks/useStateWithDynamicDefault';
4
+ import { arraySequence, assertRange } from '../utils';
5
+ import Select from './Select';
6
+ const ValuePicker = forwardRef((props, ref) => {
7
+ const { disabled, highToLow, max = 127, min = 0, onChange, value: initialValue = 0, ...rest } = props;
8
+ const options = useMemo(() => {
9
+ const result = arraySequence(max - min + 1)
10
+ .map(i => min + i)
11
+ .map(value => ({ value, label: value }));
12
+ return (highToLow
13
+ ? result.reverse()
14
+ : result);
15
+ }, [highToLow, max, min]);
16
+ const [value, setValue] = useStateWithDynamicDefault(initialValue);
17
+ const handleChange = useCallback((v) => {
18
+ onChange(assertRange(v, max, min));
19
+ setValue(Number.parseInt(String(v), 10));
20
+ }, [max, min, onChange, setValue]);
21
+ return (_jsx(Select, { ...rest, disabled: disabled, onChange: handleChange, options: options, ref: ref, value: value }));
22
+ });
23
+ export default ValuePicker;
@@ -0,0 +1,93 @@
1
+ const knobSkin10 = {
2
+ knobX: 71.44,
3
+ knobY: 71.44,
4
+ svg: `
5
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="207px" height="207px" viewBox="0 0 207 207" version="1.1">
6
+ <!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
7
+ <desc>Created with Sketch.</desc>
8
+ <defs>
9
+ <linearGradient x1="50%" y1="50%" x2="50%" y2="100%" id="27c61b0f-392f-962d-de12-cb9da898274b">
10
+ <stop stop-color="#444040" stop-opacity="0.51098279" offset="0%"/>
11
+ <stop stop-color="#131111" stop-opacity="0.893200861" offset="100%"/>
12
+ </linearGradient>
13
+ <circle id="e966567b-3869-4bcd-76b6-2cf084e45390" cx="100.497487" cy="100.497487" r="99.4974874"/>
14
+ <filter x="-3.3%" y="-3.3%" width="106.5%" height="106.5%" filterUnits="objectBoundingBox" id="e2e6829f-0086-96b2-e92a-6f3809b8ac61">
15
+ <feMorphology radius="0.5" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"/>
16
+ <feOffset dx="0" dy="0" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/>
17
+ <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>
18
+ <feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"/>
19
+ <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"/>
20
+ </filter>
21
+ <linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="0facd5c9-8e04-e83f-4842-8ba16f949942">
22
+ <stop stop-color="#FFFFFF" stop-opacity="0.5" offset="0%"/>
23
+ <stop stop-color="#000000" stop-opacity="0.5" offset="100%"/>
24
+ </linearGradient>
25
+ <circle id="c54189ed-7ea3-956c-f040-f0207548b268" cx="100.432161" cy="100.432161" r="86.4321608"/>
26
+ <filter x="-4.0%" y="-3.5%" width="108.1%" height="108.1%" filterUnits="objectBoundingBox" id="dedf2e7e-f008-c315-f682-e424d670f210">
27
+ <feMorphology radius="0.5" operator="dilate" in="SourceAlpha" result="shadowSpreadOuter1"/>
28
+ <feOffset dx="0" dy="1" in="shadowSpreadOuter1" result="shadowOffsetOuter1"/>
29
+ <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>
30
+ <feComposite in="shadowBlurOuter1" in2="SourceAlpha" operator="out" result="shadowBlurOuter1"/>
31
+ <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1"/>
32
+ </filter>
33
+
34
+ <filter x="-5.3%" y="-11.3%" width="110.7%" height="122.6%" filterUnits="objectBoundingBox" id="12f618f7-e258-b597-3ed6-242484ddad8f">
35
+ <feOffset dx="0" dy="0" in="SourceAlpha" result="shadowOffsetOuter1"/>
36
+ <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"/>
37
+ <feColorMatrix values="0 0 0 0 0.915577168 0 0 0 0 0.797591325 0 0 0 0 0.601479722 0 0 0 1 0" type="matrix" in="shadowBlurOuter1"/>
38
+ </filter>
39
+ <pattern id="3cc0e5b8-1f0a-886b-f635-8fcb19212870" width="8.04411765" height="8.04411765" x="21.9558824" y="21.9558824" patternUnits="userSpaceOnUse">
40
+ <use xlink:href="#2b8719c1-286b-ebf8-a488-ac66a6598fc5" transform="scale(0.167585784,0.167585784)"/>
41
+ </pattern>
42
+ <image id="2b8719c1-286b-ebf8-a488-ac66a6598fc5" width="48" height="48" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAEGWlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPrtzZyMkzlNsNIV0qD8NJQ2TVjShtLp/3d02bpZJNtoi6GT27s6Yyc44M7v9oU9FUHwx6psUxL+3gCAo9Q/bPrQvlQol2tQgKD60+INQ6Ium65k7M5lpurHeZe58853vnnvuuWfvBei5qliWkRQBFpquLRcy4nOHj4g9K5CEh6AXBqFXUR0rXalMAjZPC3e1W99Dwntf2dXd/p+tt0YdFSBxH2Kz5qgLiI8B8KdVy3YBevqRHz/qWh72Yui3MUDEL3q44WPXw3M+fo1pZuQs4tOIBVVTaoiXEI/MxfhGDPsxsNZfoE1q66ro5aJim3XdoLFw72H+n23BaIXzbcOnz5mfPoTvYVz7KzUl5+FRxEuqkp9G/Ajia219thzg25abkRE/BpDc3pqvphHvRFys2weqvp+krbWKIX7nhDbzLOItiM8358pTwdirqpPFnMF2xLc1WvLyOwTAibpbmvHHcvttU57y5+XqNZrLe3lE/Pq8eUj2fXKfOe3pfOjzhJYtB/yll5SDFcSDiH+hRkH25+L+sdxKEAMZahrlSX8ukqMOWy/jXW2m6M9LDBc31B9LFuv6gVKg/0Szi3KAr1kGq1GMjU/aLbnq6/lRxc4XfJ98hTargX++DbMJBSiYMIe9Ck1YAxFkKEAG3xbYaKmDDgYyFK0UGYpfoWYXG+fAPPI6tJnNwb7ClP7IyF+D+bjOtCpkhz6CFrIa/I6sFtNl8auFXGMTP34sNwI/JhkgEtmDz14ySfaRcTIBInmKPE32kxyyE2Tv+thKbEVePDfW/byMM1Kmm0XdObS7oGD/MypMXFPXrCwOtoYjyyn7BV29/MZfsVzpLDdRtuIZnbpXzvlf+ev8MvYr/Gqk4H/kV/G3csdazLuyTMPsbFhzd1UabQbjFvDRmcWJxR3zcfHkVw9GfpbJmeev9F08WW8uDkaslwX6avlWGU6NRKz0g/SHtCy9J30o/ca9zX3Kfc19zn3BXQKRO8ud477hLnAfc1/G9mrzGlrfexZ5GLdn6ZZrrEohI2wVHhZywjbhUWEy8icMCGNCUdiBlq3r+xafL549HQ5jH+an+1y+LlYBifuxAvRN/lVVVOlwlCkdVm9NOL5BE4wkQ2SMlDZU97hX86EilU/lUmkQUztTE6mx1EEPh7OmdqBtAvv8HdWpbrJS6tJj3n0CWdM6busNzRV3S9KTYhqvNiqWmuroiKgYhshMjmhTh9ptWhsF7970j/SbMrsPE1suR5z7DMC+P/Hs+y7ijrQAlhyAgccjbhjPygfeBTjzhNqy28EdkUh8C+DU9+z2v/oyeH791OncxHOs5y2AtTc7nb/f73TWPkD/qwBnjX8BoJ98VQNcC+8AAAFFSURBVGgF7djbDYMwDAXQBjEMYqyqY1WMxTppLiJIQIA8ariWkp8IPuweO60am67r7MstY8wwjuPH7dMz3uUua63p+/7r9rePIRW/9QmQzCV9ub0YgSIgzhxvQkjFb1EZBAdEKolkfJTqtnb7bv/zOJm58moRE0AzYgFoRawAGhE7gDZEEKAJcQjQgjgFaEBcAtgRUQBmRDSAFZEEYEQkA9gQWQAmRDaABVEEYEAUAx5H4EaGOyw+SMl66mbXzNOD4k6gCPNUY/CFwF1YOn5zRxJJRINqaUbUuZA/79sd3wm3xIdbdS60rXzo2XVCbO60/HxKJgFKKv4CkEziuyKBWAE0InYAbYggQBPiEKAFcQrQgLgEsCOiAMyIaAArIgnAiEgGsCGyAEyIbAALogjAgCgGPI7AX9w6F3JtqHMhnMWLFSrSD9jOnakVHpZYAAAAAElFTkSuQmCC"/>
43
+ </defs>
44
+ <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
45
+ <g id="s10" transform="translate(3.000000, 3.000000)">
46
+ <g id="container">
47
+ <g id="Oval-2">
48
+ <use fill="black" fill-opacity="1" filter="url(#e2e6829f-0086-96b2-e92a-6f3809b8ac61)" xlink:href="#e966567b-3869-4bcd-76b6-2cf084e45390"/>
49
+ <use stroke="#979797" stroke-width="1" fill="url(#27c61b0f-392f-962d-de12-cb9da898274b)" fill-rule="evenodd" xlink:href="#e966567b-3869-4bcd-76b6-2cf084e45390"/>
50
+ </g>
51
+ <g id="Oval-2">
52
+ <use fill="black" fill-opacity="1" filter="url(#dedf2e7e-f008-c315-f682-e424d670f210)" xlink:href="#c54189ed-7ea3-956c-f040-f0207548b268"/>
53
+ <use fill="" fill-rule="evenodd" xlink:href="#c54189ed-7ea3-956c-f040-f0207548b268"/>
54
+ <use stroke="#4A4A4A" stroke-width="1" fill="url(#0facd5c9-8e04-e83f-4842-8ba16f949942)" fill-rule="evenodd" xlink:href="#c54189ed-7ea3-956c-f040-f0207548b268"/>
55
+ </g>
56
+ <g id="knob" transform="translate(28.574244, 28.574244)">
57
+ <circle id="Oval-5" fill="#322E2E" cx="71.4356094" cy="71.4356094" r="71.4356094"/>
58
+ <path d="M72.4209282,3.63066376 L88.6786876,16.869789 C81.585496,18.1548295 76.1662428,18.7973498 72.4209282,18.7973498 C68.6756135,18.7973498 63.2563604,18.1548295 56.1631688,16.869789 L72.4209282,3.63066376 Z" id="Rectangle" fill="#E6D7D7" transform="translate(72.420928, 11.214007) scale(1, -1) translate(-72.420928, -11.214007) "/>
59
+ </g>
60
+ <g id="label">
61
+ <g id="labeltext" fill-opacity="1" fill="#E6D7D7">
62
+ <text id="534f4e02-5541-3607-0966-af0b025d80e0" font-family="Helvetica" font-size="44" font-weight="normal" fill="#E6D7D7" class="text-7" filter="url(#12f618f7-e258-b597-3ed6-242484ddad8f)">
63
+ <tspan x="45.3246625" y="117.884225">10.10</tspan>
64
+ </text>
65
+ <text id="92ebe866-c281-70c7-7b0e-a373cee013a9" font-family="Helvetica" font-size="44" font-weight="normal" fill="#E6D7D7" class="text-7">
66
+ <tspan x="45.3246625" y="117.884225">10.10</tspan>
67
+ </text>
68
+ </g>
69
+ <circle id="Oval-6" stroke="#979797" fill-opacity="0.730000019" fill="url(#3cc0e5b8-1f0a-886b-f635-8fcb19212870)" transform="translate(100.351759, 100.351759) rotate(-45.000000) translate(-100.351759, -100.351759) " cx="100.351759" cy="100.351759" r="70.3517588"/>
70
+ </g>
71
+ </g>
72
+ </g>
73
+ </g>
74
+ </svg>
75
+ `,
76
+ updateAttributes: [
77
+ {
78
+ element: '#labeltext text tspan',
79
+ content: (_props, value) => value.toFixed(0),
80
+ attrs: [
81
+ {
82
+ name: 'text-anchor',
83
+ value: ( /* props, value */) => 'middle',
84
+ },
85
+ {
86
+ name: 'x',
87
+ value: ( /* props, value */) => '100',
88
+ },
89
+ ],
90
+ },
91
+ ],
92
+ };
93
+ export default knobSkin10;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ class InternalInput extends React.Component {
4
+ render() {
5
+ const props = this.props;
6
+ const hideStyle = {};
7
+ function onValChange(event) {
8
+ props.onChange(Number(event.target.value));
9
+ }
10
+ const { value, min, max, step, onChange, inputRef, ...rest } = props;
11
+ return (_jsx("input", { ref: inputRef, value: value, step: step, onChange: onValChange, style: hideStyle, type: "range", min: min, max: max, ...rest }));
12
+ }
13
+ }
14
+ Object.defineProperty(InternalInput, "defaultProps", {
15
+ enumerable: true,
16
+ configurable: true,
17
+ writable: true,
18
+ value: {
19
+ step: 1,
20
+ }
21
+ });
22
+ export default InternalInput;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ class DrawCircle extends React.Component {
4
+ render() {
5
+ const { r, borderColor = 'black', fillColor = 'transparent', borderWidth = 2, fillOpacity = 1, ...rest } = this.props;
6
+ return (_jsx("circle", { stroke: borderColor, fill: fillColor, fillOpacity: fillOpacity, r: r, ...rest }));
7
+ }
8
+ }
9
+ export default DrawCircle;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ class DrawLine extends React.Component {
4
+ render() {
5
+ const { width = 2, color = 'black', p1, p2, ...rest } = this.props;
6
+ return (_jsx("line", { ...rest, stroke: color, strokeWidth: width, x1: p1.x, y1: p1.y, x2: p2.x, y2: p2.y }));
7
+ }
8
+ }
9
+ export default DrawLine;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import ReactDOM from 'react-dom';
4
+ /**
5
+ * Draws the overlay and the children
6
+ */
7
+ class HelpersOverlay extends React.Component {
8
+ render() {
9
+ const { children, ...rest } = this.props;
10
+ const styles = {
11
+ overlay: Object.assign({
12
+ width: '100%',
13
+ height: '100vh',
14
+ top: 0,
15
+ left: 0,
16
+ zIndex: 2147483647,
17
+ margin: '0',
18
+ padding: '0',
19
+ boxSizing: 'border-box',
20
+ position: 'fixed',
21
+ }, this.props.overlayStyle),
22
+ };
23
+ return ReactDOM.createPortal(_jsx("div", { style: styles.overlay, ...rest, children: children }), document.body);
24
+ }
25
+ }
26
+ export default HelpersOverlay;