zds-pickers 4.0.11 → 4.0.13

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.
package/dist/index.js CHANGED
@@ -1,21 +1,19 @@
1
- // Components
2
- export { default as ChannelMappingPicker } from './pickers/ChannelMappingPicker';
3
- export { default as ChannelPicker } from './pickers/ChannelPicker';
4
- export { default as DefaultTooltip } from './other/DefaultTooltip';
5
- export { default as Knob } from './pickers/Knob';
6
- export { default as KnobPicker } from './pickers/KnobPicker';
7
- export { default as LatchPicker } from './pickers/LatchPicker';
8
- export { default as MappingPicker } from './pickers/MappingPicker';
9
- export { default as NotePicker } from './pickers/NotePicker';
10
- export { default as OctavePlayer } from './other/OctavePlayer';
11
- export { default as PianoPicker } from './pickers/PianoPicker';
12
- export { default as PolarityPicker } from './pickers/PolarityPicker';
13
- export { default as ResponseCurvePicker } from './pickers/ResponseCurvePicker';
14
- export { default as Select } from './pickers/Select';
15
- export { default as StatusPicker } from './pickers/StatusPicker';
16
- export { default as SVGText } from './other/SVGText';
17
- export { default as ValuePicker } from './pickers/ValuePicker';
18
- // MIDI Values & Functions
19
- export { combineStatusWithChannel, extractStatusAndChannel, getStatusLabel, MASK_CHANNEL, MASK_STATUS, Statuses, } from './midi/export';
20
- export { default as ResponseCurve, RESPONSE_CURVES, } from './pickers/ResponseCurve';
21
- export { default as ccValues } from './midi/ccValues';
1
+ export * from './midi/ccValues';
2
+ export * from './midi/export';
3
+ export * from './other/DefaultTooltip';
4
+ export * from './other/OctavePlayer';
5
+ export * from './other/SVGText';
6
+ export * from './pickers/ChannelMappingPicker';
7
+ export * from './pickers/ChannelPicker';
8
+ export * from './pickers/Knob';
9
+ export * from './pickers/KnobPicker';
10
+ export * from './pickers/LatchPicker';
11
+ export * from './pickers/MappingPicker';
12
+ export * from './pickers/NotePicker';
13
+ export * from './pickers/PianoPicker';
14
+ export * from './pickers/PolarityPicker';
15
+ export * from './pickers/ResponseCurve';
16
+ export * from './pickers/ResponseCurvePicker';
17
+ export * from './pickers/Select';
18
+ export * from './pickers/StatusPicker';
19
+ export * from './pickers/ValuePicker';
@@ -24,4 +24,46 @@ const extractStatusAndChannel = (status) => ({
24
24
  status: (((status & MASK_STATUS) >> 4) | 8),
25
25
  channel: status & MASK_CHANNEL,
26
26
  });
27
- export { combineStatusWithChannel, extractStatusAndChannel, getStatusLabel, MASK_CHANNEL, MASK_STATUS, statusOptions, Statuses, };
27
+ const RESPONSE_CURVE_0 = 0;
28
+ const RESPONSE_CURVE_1 = 1;
29
+ const RESPONSE_CURVE_2 = 2;
30
+ const RESPONSE_CURVE_3 = 3;
31
+ const RESPONSE_CURVE_4 = 4;
32
+ const RESPONSE_CURVE_5 = 5;
33
+ const RESPONSE_CURVE_6 = 6;
34
+ const RESPONSE_CURVE_7 = 7;
35
+ const responseCurves = [
36
+ {
37
+ value: RESPONSE_CURVE_7,
38
+ label: 'Always maxed out.',
39
+ },
40
+ {
41
+ value: RESPONSE_CURVE_6,
42
+ label: 'Most sensitive.',
43
+ },
44
+ {
45
+ value: RESPONSE_CURVE_5,
46
+ label: 'Moderately sensitive.',
47
+ },
48
+ {
49
+ value: RESPONSE_CURVE_4,
50
+ label: 'A little sensitive.',
51
+ },
52
+ {
53
+ value: RESPONSE_CURVE_0,
54
+ label: 'Linear, no change.',
55
+ },
56
+ {
57
+ value: RESPONSE_CURVE_1,
58
+ label: 'A little less sensitive.',
59
+ },
60
+ {
61
+ value: RESPONSE_CURVE_2,
62
+ label: 'Even less sensitive.',
63
+ },
64
+ {
65
+ value: RESPONSE_CURVE_3,
66
+ label: 'Least sensitive.',
67
+ },
68
+ ];
69
+ export { combineStatusWithChannel, extractStatusAndChannel, getStatusLabel, MASK_CHANNEL, MASK_STATUS, responseCurves, Statuses, statusOptions, };
@@ -1,50 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef } from 'react';
3
3
  import useComponentSize from '../hooks/useComponentSize';
4
+ import { responseCurves as origResponseCurves, } from '../midi/export';
4
5
  import DefaultTooltip from '../other/DefaultTooltip';
5
6
  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
7
  // const width = 218
49
8
  // const height = 150
50
9
  const axisOffset = 20;
@@ -63,7 +22,7 @@ const ResponseCurve = (props) => {
63
22
  const xMid = width / 2;
64
23
  const yMid = height / 2;
65
24
  const svgProps = { ref: svgRef };
66
- const responseCurves = RESPONSE_CURVES.map(
25
+ const responseCurves = origResponseCurves.map(
67
26
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
68
27
  ({ value, label }) => {
69
28
  let c1 = 0;
@@ -75,48 +34,48 @@ const ResponseCurve = (props) => {
75
34
  let labelX = xMid;
76
35
  let labelY = yMid;
77
36
  switch (value) {
78
- case RESPONSE_CURVE_0:
37
+ case responseCurves[0].value:
79
38
  c1 = xMid;
80
39
  c2 = yMid;
81
40
  labelY += 3;
82
41
  break;
83
- case RESPONSE_CURVE_1:
42
+ case responseCurves[1].value:
84
43
  c1 = inverted ? xMid + width * 0.13 : xMid - width * 0.13;
85
44
  c2 = yMid - height * 0.13;
86
45
  labelX = inverted ? xMid + width * 0.1 : xMid - width * 0.1;
87
46
  labelY = yMid - height * 0.09;
88
47
  break;
89
- case RESPONSE_CURVE_2:
48
+ case responseCurves[2].value:
90
49
  c1 = inverted ? xMid + width * 0.25 : xMid - width * 0.25;
91
50
  c2 = yMid - height * 0.25;
92
51
  labelX = inverted ? xMid + width * 0.2 : xMid - width * 0.2;
93
52
  labelY = yMid - height * 0.17;
94
53
  break;
95
- case RESPONSE_CURVE_3:
54
+ case responseCurves[3].value:
96
55
  c1 = inverted ? xMid + width * 0.35 : xMid - width * 0.35;
97
56
  c2 = yMid - height * 0.35;
98
57
  labelX = inverted ? xMid + width * 0.28 : xMid - width * 0.28;
99
58
  labelY = yMid - height * 0.25;
100
59
  break;
101
- case RESPONSE_CURVE_4:
60
+ case responseCurves[4].value:
102
61
  c1 = inverted ? xMid - width * 0.13 : xMid + width * 0.13;
103
62
  c2 = yMid + height * 0.13;
104
63
  labelX = inverted ? xMid - width * 0.1 : xMid + width * 0.1;
105
64
  labelY = yMid + height * 0.1;
106
65
  break;
107
- case RESPONSE_CURVE_5:
66
+ case responseCurves[5].value:
108
67
  c1 = inverted ? xMid - width * 0.25 : xMid + width * 0.25;
109
68
  c2 = yMid + height * 0.25;
110
69
  labelX = inverted ? xMid - width * 0.2 : xMid + width * 0.2;
111
70
  labelY = yMid + height * 0.18;
112
71
  break;
113
- case RESPONSE_CURVE_6:
72
+ case responseCurves[6].value:
114
73
  c1 = inverted ? xMid - width * 0.35 : xMid + width * 0.35;
115
74
  c2 = yMid + height * 0.35;
116
75
  labelX = inverted ? xMid - width * 0.28 : xMid + width * 0.28;
117
76
  labelY = yMid + height * 0.25;
118
77
  break;
119
- case RESPONSE_CURVE_7:
78
+ case responseCurves[7].value:
120
79
  x1 = inverted ? axisX1 : axisX2;
121
80
  y1 = axisY1;
122
81
  x2 = x1;
@@ -151,4 +110,3 @@ const ResponseCurve = (props) => {
151
110
  }), 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
111
  };
153
112
  export default ResponseCurve;
154
- export { RESPONSE_CURVES };
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useCallback } from 'react';
3
+ import { responseCurves } from '../midi/export';
3
4
  import DefaultTooltip from '../other/DefaultTooltip';
4
5
  import { findObj } from '../utils';
5
- import ResponseCurve, { RESPONSE_CURVES } from './ResponseCurve';
6
+ import ResponseCurve from './ResponseCurve';
6
7
  import Select from './Select';
7
8
  const ResponseCurvePicker = forwardRef((props, ref) => {
8
9
  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 Placeholder = useCallback(() => (_jsx("div", { className: "singleValue", children: findObj('value', value)(responseCurves)?.label })), [value]);
10
11
  const MenuList = useCallback(({ setValue }) => (_jsx(ResponseCurve, { autosize: true, inverted: inverted, onChange: ({ target: { value: v } }) => {
11
12
  setValue(v);
12
13
  onChange(v);
@@ -1,19 +1,22 @@
1
- export { default as ChannelMappingPicker } from './pickers/ChannelMappingPicker';
2
- export { default as ChannelPicker } from './pickers/ChannelPicker';
3
- export { default as DefaultTooltip } from './other/DefaultTooltip';
4
- export { default as Knob } from './pickers/Knob';
5
- export { default as KnobPicker } from './pickers/KnobPicker';
6
- export { default as LatchPicker } from './pickers/LatchPicker';
7
- export { default as MappingPicker } from './pickers/MappingPicker';
8
- export { default as NotePicker } from './pickers/NotePicker';
9
- export { default as OctavePlayer } from './other/OctavePlayer';
10
- export { default as PianoPicker } from './pickers/PianoPicker';
11
- export { default as PolarityPicker } from './pickers/PolarityPicker';
12
- export { default as ResponseCurvePicker } from './pickers/ResponseCurvePicker';
13
- export { default as Select } from './pickers/Select';
14
- export { default as StatusPicker } from './pickers/StatusPicker';
15
- export { default as SVGText } from './other/SVGText';
16
- export { default as ValuePicker } from './pickers/ValuePicker';
1
+ export * from './midi/ccValues';
2
+ export * from './midi/export';
3
+ export * from './other/DefaultTooltip';
4
+ export * from './other/OctavePlayer';
5
+ export * from './other/SVGText';
6
+ export * from './pickers/ChannelMappingPicker';
7
+ export * from './pickers/ChannelPicker';
8
+ export * from './pickers/Knob';
9
+ export * from './pickers/KnobPicker';
10
+ export * from './pickers/LatchPicker';
11
+ export * from './pickers/MappingPicker';
12
+ export * from './pickers/NotePicker';
13
+ export * from './pickers/PianoPicker';
14
+ export * from './pickers/PolarityPicker';
15
+ export * from './pickers/ResponseCurve';
16
+ export * from './pickers/ResponseCurvePicker';
17
+ export * from './pickers/Select';
18
+ export * from './pickers/StatusPicker';
19
+ export * from './pickers/ValuePicker';
17
20
  export type * from './midi/export';
18
21
  export type * from './other/DefaultTooltip';
19
22
  export type * from './other/OctavePlayer';
@@ -35,6 +38,3 @@ export type * from './pickers/Select';
35
38
  export type * from './pickers/StatusPicker';
36
39
  export type * from './pickers/ValuePicker';
37
40
  export type * from './rotaryKnob/InternalInput';
38
- export { combineStatusWithChannel, extractStatusAndChannel, getStatusLabel, MASK_CHANNEL, MASK_STATUS, Statuses, } from './midi/export';
39
- export { default as ResponseCurve, RESPONSE_CURVES, } from './pickers/ResponseCurve';
40
- export { default as ccValues } from './midi/ccValues';
@@ -18,4 +18,15 @@ declare const extractStatusAndChannel: (status: number) => {
18
18
  status: Status;
19
19
  channel: number;
20
20
  };
21
- export { combineStatusWithChannel, extractStatusAndChannel, getStatusLabel, MASK_CHANNEL, MASK_STATUS, statusOptions, Statuses, type Status, };
21
+ declare const RESPONSE_CURVE_0 = 0;
22
+ declare const RESPONSE_CURVE_1 = 1;
23
+ declare const RESPONSE_CURVE_2 = 2;
24
+ declare const RESPONSE_CURVE_3 = 3;
25
+ declare const RESPONSE_CURVE_4 = 4;
26
+ declare const RESPONSE_CURVE_5 = 5;
27
+ declare const RESPONSE_CURVE_6 = 6;
28
+ declare const RESPONSE_CURVE_7 = 7;
29
+ type Curve = typeof RESPONSE_CURVE_0 | typeof RESPONSE_CURVE_1 | typeof RESPONSE_CURVE_2 | typeof RESPONSE_CURVE_3 | typeof RESPONSE_CURVE_4 | typeof RESPONSE_CURVE_5 | typeof RESPONSE_CURVE_6 | typeof RESPONSE_CURVE_7;
30
+ declare const responseCurves: Option<Curve>[];
31
+ export { combineStatusWithChannel, extractStatusAndChannel, getStatusLabel, MASK_CHANNEL, MASK_STATUS, responseCurves, Statuses, statusOptions, };
32
+ export type { Curve, Status };
@@ -1,14 +1,5 @@
1
+ import { type Curve } from '../midi/export';
1
2
  import { type TooltipProps } from '../other/DefaultTooltip';
2
- import type { Option } from './Select';
3
- declare const RESPONSE_CURVE_0 = 0;
4
- declare const RESPONSE_CURVE_1 = 1;
5
- declare const RESPONSE_CURVE_2 = 2;
6
- declare const RESPONSE_CURVE_3 = 3;
7
- declare const RESPONSE_CURVE_4 = 4;
8
- declare const RESPONSE_CURVE_5 = 5;
9
- declare const RESPONSE_CURVE_6 = 6;
10
- declare const RESPONSE_CURVE_7 = 7;
11
- type Curve = typeof RESPONSE_CURVE_0 | typeof RESPONSE_CURVE_1 | typeof RESPONSE_CURVE_2 | typeof RESPONSE_CURVE_3 | typeof RESPONSE_CURVE_4 | typeof RESPONSE_CURVE_5 | typeof RESPONSE_CURVE_6 | typeof RESPONSE_CURVE_7;
12
3
  type ResponseCurve = {
13
4
  value: Curve;
14
5
  label: React.ReactNode;
@@ -21,7 +12,6 @@ type ResponseCurve = {
21
12
  labelX: number;
22
13
  labelY: number;
23
14
  };
24
- declare const RESPONSE_CURVES: Option<Curve>[];
25
15
  type ResponseCurveProps = {
26
16
  autosize: boolean;
27
17
  disabled?: boolean;
@@ -36,5 +26,4 @@ type ResponseCurveProps = {
36
26
  };
37
27
  declare const ResponseCurve: (props: ResponseCurveProps) => import("react/jsx-runtime").JSX.Element;
38
28
  export default ResponseCurve;
39
- export { RESPONSE_CURVES };
40
- export type { Curve, ResponseCurve, ResponseCurveProps };
29
+ export type { ResponseCurve, ResponseCurveProps };
@@ -1,6 +1,6 @@
1
1
  import type { GroupBase, SelectInstance } from 'react-select';
2
+ import { type Curve } from '../midi/export';
2
3
  import { type TooltipProps } from '../other/DefaultTooltip';
3
- import { type Curve } from './ResponseCurve';
4
4
  import type { Option, SelectProps } from './Select';
5
5
  type ResponseCurvePickerProps = SelectProps<Curve> & {
6
6
  inverted?: boolean;
package/lib/index.ts CHANGED
@@ -1,20 +1,24 @@
1
- // Components
2
- export { default as ChannelMappingPicker } from './pickers/ChannelMappingPicker'
3
- export { default as ChannelPicker } from './pickers/ChannelPicker'
4
- export { default as DefaultTooltip } from './other/DefaultTooltip'
5
- export { default as Knob } from './pickers/Knob'
6
- export { default as KnobPicker } from './pickers/KnobPicker'
7
- export { default as LatchPicker } from './pickers/LatchPicker'
8
- export { default as MappingPicker } from './pickers/MappingPicker'
9
- export { default as NotePicker } from './pickers/NotePicker'
10
- export { default as OctavePlayer } from './other/OctavePlayer'
11
- export { default as PianoPicker } from './pickers/PianoPicker'
12
- export { default as PolarityPicker } from './pickers/PolarityPicker'
13
- export { default as ResponseCurvePicker } from './pickers/ResponseCurvePicker'
14
- export { default as Select } from './pickers/Select'
15
- export { default as StatusPicker } from './pickers/StatusPicker'
16
- export { default as SVGText } from './other/SVGText'
17
- export { default as ValuePicker } from './pickers/ValuePicker'
1
+ export * from './midi/ccValues'
2
+ export * from './midi/export'
3
+
4
+ export * from './other/DefaultTooltip'
5
+ export * from './other/OctavePlayer'
6
+ export * from './other/SVGText'
7
+
8
+ export * from './pickers/ChannelMappingPicker'
9
+ export * from './pickers/ChannelPicker'
10
+ export * from './pickers/Knob'
11
+ export * from './pickers/KnobPicker'
12
+ export * from './pickers/LatchPicker'
13
+ export * from './pickers/MappingPicker'
14
+ export * from './pickers/NotePicker'
15
+ export * from './pickers/PianoPicker'
16
+ export * from './pickers/PolarityPicker'
17
+ export * from './pickers/ResponseCurve'
18
+ export * from './pickers/ResponseCurvePicker'
19
+ export * from './pickers/Select'
20
+ export * from './pickers/StatusPicker'
21
+ export * from './pickers/ValuePicker'
18
22
 
19
23
  // Types
20
24
  export type * from './midi/export'
@@ -41,20 +45,3 @@ export type * from './pickers/StatusPicker'
41
45
  export type * from './pickers/ValuePicker'
42
46
 
43
47
  export type * from './rotaryKnob/InternalInput'
44
-
45
- // MIDI Values & Functions
46
- export {
47
- combineStatusWithChannel,
48
- extractStatusAndChannel,
49
- getStatusLabel,
50
- MASK_CHANNEL,
51
- MASK_STATUS,
52
- Statuses,
53
- } from './midi/export'
54
-
55
- export {
56
- default as ResponseCurve,
57
- RESPONSE_CURVES,
58
- } from './pickers/ResponseCurve'
59
-
60
- export { default as ccValues } from './midi/ccValues'
@@ -41,13 +41,69 @@ const extractStatusAndChannel = (
41
41
  channel: status & MASK_CHANNEL,
42
42
  })
43
43
 
44
+ const RESPONSE_CURVE_0 = 0
45
+ const RESPONSE_CURVE_1 = 1
46
+ const RESPONSE_CURVE_2 = 2
47
+ const RESPONSE_CURVE_3 = 3
48
+ const RESPONSE_CURVE_4 = 4
49
+ const RESPONSE_CURVE_5 = 5
50
+ const RESPONSE_CURVE_6 = 6
51
+ const RESPONSE_CURVE_7 = 7
52
+
53
+ type Curve =
54
+ | typeof RESPONSE_CURVE_0
55
+ | typeof RESPONSE_CURVE_1
56
+ | typeof RESPONSE_CURVE_2
57
+ | typeof RESPONSE_CURVE_3
58
+ | typeof RESPONSE_CURVE_4
59
+ | typeof RESPONSE_CURVE_5
60
+ | typeof RESPONSE_CURVE_6
61
+ | typeof RESPONSE_CURVE_7
62
+
63
+ const responseCurves: Option<Curve>[] = [
64
+ {
65
+ value: RESPONSE_CURVE_7,
66
+ label: 'Always maxed out.',
67
+ },
68
+ {
69
+ value: RESPONSE_CURVE_6,
70
+ label: 'Most sensitive.',
71
+ },
72
+ {
73
+ value: RESPONSE_CURVE_5,
74
+ label: 'Moderately sensitive.',
75
+ },
76
+ {
77
+ value: RESPONSE_CURVE_4,
78
+ label: 'A little sensitive.',
79
+ },
80
+ {
81
+ value: RESPONSE_CURVE_0,
82
+ label: 'Linear, no change.',
83
+ },
84
+ {
85
+ value: RESPONSE_CURVE_1,
86
+ label: 'A little less sensitive.',
87
+ },
88
+ {
89
+ value: RESPONSE_CURVE_2,
90
+ label: 'Even less sensitive.',
91
+ },
92
+ {
93
+ value: RESPONSE_CURVE_3,
94
+ label: 'Least sensitive.',
95
+ },
96
+ ]
97
+
44
98
  export {
45
99
  combineStatusWithChannel,
46
100
  extractStatusAndChannel,
47
101
  getStatusLabel,
48
102
  MASK_CHANNEL,
49
103
  MASK_STATUS,
50
- statusOptions,
104
+ responseCurves,
51
105
  Statuses,
52
- type Status,
106
+ statusOptions,
53
107
  }
108
+
109
+ export type { Curve, Status }
@@ -1,27 +1,11 @@
1
1
  import { useRef } from 'react'
2
2
  import useComponentSize from '../hooks/useComponentSize'
3
+ import {
4
+ type Curve,
5
+ responseCurves as origResponseCurves,
6
+ } from '../midi/export'
3
7
  import DefaultTooltip, { type TooltipProps } from '../other/DefaultTooltip'
4
8
  import SVGText from '../other/SVGText'
5
- import type { Option } from './Select'
6
-
7
- const RESPONSE_CURVE_0 = 0
8
- const RESPONSE_CURVE_1 = 1
9
- const RESPONSE_CURVE_2 = 2
10
- const RESPONSE_CURVE_3 = 3
11
- const RESPONSE_CURVE_4 = 4
12
- const RESPONSE_CURVE_5 = 5
13
- const RESPONSE_CURVE_6 = 6
14
- const RESPONSE_CURVE_7 = 7
15
-
16
- type Curve =
17
- | typeof RESPONSE_CURVE_0
18
- | typeof RESPONSE_CURVE_1
19
- | typeof RESPONSE_CURVE_2
20
- | typeof RESPONSE_CURVE_3
21
- | typeof RESPONSE_CURVE_4
22
- | typeof RESPONSE_CURVE_5
23
- | typeof RESPONSE_CURVE_6
24
- | typeof RESPONSE_CURVE_7
25
9
 
26
10
  type ResponseCurve = {
27
11
  value: Curve
@@ -36,41 +20,6 @@ type ResponseCurve = {
36
20
  labelY: number
37
21
  }
38
22
 
39
- const RESPONSE_CURVES: Option<Curve>[] = [
40
- {
41
- value: RESPONSE_CURVE_7,
42
- label: 'Always maxed out.',
43
- },
44
- {
45
- value: RESPONSE_CURVE_6,
46
- label: 'Most sensitive.',
47
- },
48
- {
49
- value: RESPONSE_CURVE_5,
50
- label: 'Moderately sensitive.',
51
- },
52
- {
53
- value: RESPONSE_CURVE_4,
54
- label: 'A little sensitive.',
55
- },
56
- {
57
- value: RESPONSE_CURVE_0,
58
- label: 'Linear, no change.',
59
- },
60
- {
61
- value: RESPONSE_CURVE_1,
62
- label: 'A little less sensitive.',
63
- },
64
- {
65
- value: RESPONSE_CURVE_2,
66
- label: 'Even less sensitive.',
67
- },
68
- {
69
- value: RESPONSE_CURVE_3,
70
- label: 'Least sensitive.',
71
- },
72
- ]
73
-
74
23
  // const width = 218
75
24
  // const height = 150
76
25
  const axisOffset = 20
@@ -113,7 +62,7 @@ const ResponseCurve = (props: ResponseCurveProps) => {
113
62
 
114
63
  const svgProps = { ref: svgRef }
115
64
 
116
- const responseCurves = RESPONSE_CURVES.map(
65
+ const responseCurves = origResponseCurves.map(
117
66
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
118
67
  ({ value, label }): ResponseCurve => {
119
68
  let c1 = 0
@@ -125,55 +74,55 @@ const ResponseCurve = (props: ResponseCurveProps) => {
125
74
  let labelX = xMid
126
75
  let labelY = yMid
127
76
  switch (value) {
128
- case RESPONSE_CURVE_0:
77
+ case responseCurves[0].value:
129
78
  c1 = xMid
130
79
  c2 = yMid
131
80
  labelY += 3
132
81
 
133
82
  break
134
- case RESPONSE_CURVE_1:
83
+ case responseCurves[1].value:
135
84
  c1 = inverted ? xMid + width * 0.13 : xMid - width * 0.13
136
85
  c2 = yMid - height * 0.13
137
86
  labelX = inverted ? xMid + width * 0.1 : xMid - width * 0.1
138
87
  labelY = yMid - height * 0.09
139
88
  break
140
89
 
141
- case RESPONSE_CURVE_2:
90
+ case responseCurves[2].value:
142
91
  c1 = inverted ? xMid + width * 0.25 : xMid - width * 0.25
143
92
  c2 = yMid - height * 0.25
144
93
  labelX = inverted ? xMid + width * 0.2 : xMid - width * 0.2
145
94
  labelY = yMid - height * 0.17
146
95
  break
147
96
 
148
- case RESPONSE_CURVE_3:
97
+ case responseCurves[3].value:
149
98
  c1 = inverted ? xMid + width * 0.35 : xMid - width * 0.35
150
99
  c2 = yMid - height * 0.35
151
100
  labelX = inverted ? xMid + width * 0.28 : xMid - width * 0.28
152
101
  labelY = yMid - height * 0.25
153
102
  break
154
103
 
155
- case RESPONSE_CURVE_4:
104
+ case responseCurves[4].value:
156
105
  c1 = inverted ? xMid - width * 0.13 : xMid + width * 0.13
157
106
  c2 = yMid + height * 0.13
158
107
  labelX = inverted ? xMid - width * 0.1 : xMid + width * 0.1
159
108
  labelY = yMid + height * 0.1
160
109
  break
161
110
 
162
- case RESPONSE_CURVE_5:
111
+ case responseCurves[5].value:
163
112
  c1 = inverted ? xMid - width * 0.25 : xMid + width * 0.25
164
113
  c2 = yMid + height * 0.25
165
114
  labelX = inverted ? xMid - width * 0.2 : xMid + width * 0.2
166
115
  labelY = yMid + height * 0.18
167
116
  break
168
117
 
169
- case RESPONSE_CURVE_6:
118
+ case responseCurves[6].value:
170
119
  c1 = inverted ? xMid - width * 0.35 : xMid + width * 0.35
171
120
  c2 = yMid + height * 0.35
172
121
  labelX = inverted ? xMid - width * 0.28 : xMid + width * 0.28
173
122
  labelY = yMid + height * 0.25
174
123
  break
175
124
 
176
- case RESPONSE_CURVE_7:
125
+ case responseCurves[7].value:
177
126
  x1 = inverted ? axisX1 : axisX2
178
127
  y1 = axisY1
179
128
  x2 = x1
@@ -299,6 +248,4 @@ const ResponseCurve = (props: ResponseCurveProps) => {
299
248
 
300
249
  export default ResponseCurve
301
250
 
302
- export { RESPONSE_CURVES }
303
-
304
- export type { Curve, ResponseCurve, ResponseCurveProps }
251
+ export type { ResponseCurve, ResponseCurveProps }
@@ -1,8 +1,9 @@
1
1
  import { forwardRef, useCallback } from 'react'
2
2
  import type { GroupBase, SelectInstance } from 'react-select'
3
+ import { type Curve, responseCurves } from '../midi/export'
3
4
  import DefaultTooltip, { type TooltipProps } from '../other/DefaultTooltip'
4
5
  import { findObj } from '../utils'
5
- import ResponseCurve, { type Curve, RESPONSE_CURVES } from './ResponseCurve'
6
+ import ResponseCurve from './ResponseCurve'
6
7
  import Select from './Select'
7
8
  import type { Option, SelectProps } from './Select'
8
9
 
@@ -32,7 +33,7 @@ const ResponseCurvePicker = forwardRef<
32
33
  const Placeholder = useCallback(
33
34
  () => (
34
35
  <div className="singleValue">
35
- {(findObj('value', value)(RESPONSE_CURVES) as Option<Curve>)?.label}
36
+ {(findObj('value', value)(responseCurves) as Option<Curve>)?.label}
36
37
  </div>
37
38
  ),
38
39
  [value],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zds-pickers",
3
- "version": "4.0.11",
3
+ "version": "4.0.13",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "types": "./dist/types/index.d.ts",