zds-pickers 4.0.15 → 4.0.17

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,8 +1,10 @@
1
+ export * from './utils';
1
2
  export * from './midi/ccValues';
2
3
  export * from './midi/export';
3
4
  export * from './other/DefaultTooltip';
4
5
  export * from './other/OctavePlayer';
5
6
  export * from './other/SvgText';
7
+ export * from './pickers/CCPicker';
6
8
  export * from './pickers/ChannelMappingPicker';
7
9
  export * from './pickers/ChannelPicker';
8
10
  export * from './pickers/Knob';
@@ -1,8 +1,10 @@
1
+ export * from './utils';
1
2
  export * from './midi/ccValues';
2
3
  export * from './midi/export';
3
4
  export * from './other/DefaultTooltip';
4
5
  export * from './other/OctavePlayer';
5
6
  export * from './other/SvgText';
7
+ export * from './pickers/CCPicker';
6
8
  export * from './pickers/ChannelMappingPicker';
7
9
  export * from './pickers/ChannelPicker';
8
10
  export * from './pickers/Knob';
@@ -8,7 +8,7 @@ declare const Statuses: {
8
8
  readonly channelPressure: 13;
9
9
  readonly pitchWheel: 14;
10
10
  };
11
- type Status = (typeof Statuses)[keyof typeof Statuses];
11
+ type Status = 8 | 9 | 10 | 11 | 12 | 13 | 14;
12
12
  declare const MASK_CHANNEL = 15;
13
13
  declare const MASK_STATUS = 240;
14
14
  declare const statusOptions: Option<Status>[];
@@ -2,7 +2,7 @@ import type { GroupBase, SelectInstance } from 'react-select';
2
2
  import type { Option, SelectProps } from './Select';
3
3
  type InternalValue = number | 'separator';
4
4
  type ChannelMappingOption = Option<InternalValue>;
5
- interface ChannelMappingPickerProps extends SelectProps<InternalValue> {
5
+ interface ChannelMappingPickerProps extends Omit<SelectProps<InternalValue>, 'options'> {
6
6
  channels: Option<number>[];
7
7
  className?: string;
8
8
  filterOptions?: (candidate: Option<InternalValue>, inputValue: string) => boolean;
@@ -1,5 +1,10 @@
1
1
  import { type JSX } from 'react';
2
2
  import { type GroupBase, type SelectInstance } from 'react-select';
3
+ type PassedSelectProps = {
4
+ actionButton?: React.ReactNode;
5
+ inputValue?: string;
6
+ placeholder?: React.ReactNode;
7
+ };
3
8
  type Option<T> = {
4
9
  label: React.ReactNode;
5
10
  value: T;
@@ -19,6 +24,7 @@ type SelectProps<T> = {
19
24
  entries: Option<T>[];
20
25
  }[];
21
26
  preserveMenuWidth?: boolean;
27
+ selectProps?: PassedSelectProps;
22
28
  shrinkLabel?: boolean;
23
29
  value: Option<T>['value'];
24
30
  };
@@ -1,12 +1,12 @@
1
1
  import type { GroupBase, SelectInstance } from 'react-select';
2
2
  import type { Option, SelectProps } from './Select';
3
- type ValuePickerProps = SelectProps<number> & {
3
+ type ValuePickerProps = Omit<SelectProps<number>, 'options'> & {
4
4
  highToLow?: boolean;
5
5
  max?: number;
6
6
  min?: number;
7
7
  };
8
8
  type ValuePickerRef = SelectInstance<Option<number>, false, GroupBase<Option<number>>>;
9
- declare const ValuePicker: import("react").ForwardRefExoticComponent<SelectProps<number> & {
9
+ declare const ValuePicker: import("react").ForwardRefExoticComponent<Omit<SelectProps<number>, "options"> & {
10
10
  highToLow?: boolean;
11
11
  max?: number;
12
12
  min?: number;
package/lib/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export * from './utils'
2
+
1
3
  export * from './midi/ccValues'
2
4
  export * from './midi/export'
3
5
 
@@ -5,6 +7,7 @@ export * from './other/DefaultTooltip'
5
7
  export * from './other/OctavePlayer'
6
8
  export * from './other/SvgText'
7
9
 
10
+ export * from './pickers/CCPicker'
8
11
  export * from './pickers/ChannelMappingPicker'
9
12
  export * from './pickers/ChannelPicker'
10
13
  export * from './pickers/Knob'
@@ -10,7 +10,8 @@ const Statuses = {
10
10
  pitchWheel: 14, // 1110
11
11
  } as const
12
12
 
13
- type Status = (typeof Statuses)[keyof typeof Statuses]
13
+ // Define type as union of literal values
14
+ type Status = 8 | 9 | 10 | 11 | 12 | 13 | 14
14
15
 
15
16
  const MASK_CHANNEL = 15 // 00001111
16
17
  const MASK_STATUS = 240 // 01110000
@@ -15,7 +15,8 @@ const defaultOptions: ChannelMappingOption[] = arraySequence(16).map(value => ({
15
15
  label: value,
16
16
  }))
17
17
 
18
- interface ChannelMappingPickerProps extends SelectProps<InternalValue> {
18
+ interface ChannelMappingPickerProps
19
+ extends Omit<SelectProps<InternalValue>, 'options'> {
19
20
  channels: Option<number>[]
20
21
  className?: string
21
22
  filterOptions?: (
@@ -20,6 +20,12 @@ import { omit } from '../utils'
20
20
 
21
21
  const { IndicatorsContainer, Placeholder, ValueContainer } = originalComponents
22
22
 
23
+ type PassedSelectProps = {
24
+ actionButton?: React.ReactNode
25
+ inputValue?: string
26
+ placeholder?: React.ReactNode
27
+ }
28
+
23
29
  type Option<T> = {
24
30
  label: React.ReactNode
25
31
  value: T
@@ -28,11 +34,8 @@ type Option<T> = {
28
34
  interface CustomIndicatorsContainerProps<T>
29
35
  extends Omit<IndicatorsContainerProps<Option<T>, false>, 'selectProps'> {
30
36
  children: React.ReactNode
31
- selectProps: IndicatorsContainerProps<Option<T>, false>['selectProps'] & {
32
- actionButton?: React.ReactNode
33
- inputValue?: string
34
- placeholder?: React.ReactNode
35
- }
37
+ selectProps: IndicatorsContainerProps<Option<T>, false>['selectProps'] &
38
+ PassedSelectProps
36
39
  }
37
40
 
38
41
  const CustomIndicatorsContainer = <T,>({
@@ -97,6 +100,7 @@ type SelectProps<T> = {
97
100
  onChange: (value: Option<T>['value']) => void
98
101
  options: Option<T>[] | { entries: Option<T>[] }[]
99
102
  preserveMenuWidth?: boolean
103
+ selectProps?: PassedSelectProps
100
104
  shrinkLabel?: boolean
101
105
  value: Option<T>['value']
102
106
  }
@@ -5,7 +5,7 @@ import { arraySequence, assertRange } from '../utils'
5
5
  import { Select } from './Select'
6
6
  import type { Option, SelectProps } from './Select'
7
7
 
8
- type ValuePickerProps = SelectProps<number> & {
8
+ type ValuePickerProps = Omit<SelectProps<number>, 'options'> & {
9
9
  highToLow?: boolean
10
10
  max?: number
11
11
  min?: number
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zds-pickers",
3
- "version": "4.0.15",
3
+ "version": "4.0.17",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -155,16 +155,17 @@ const NotePickerStory3: StoryObj<typeof NotePicker> = {
155
155
  isMelodicMode: false,
156
156
  label: 'Action button',
157
157
  mapping: gmMapping,
158
- // selectProps: {
159
- // actionButton: (
160
- // <button
161
- // onClick={e => {
162
- // window.alert('click')
163
- // }}>
164
- // ?
165
- // </button>
166
- // ),
167
- // },
158
+ selectProps: {
159
+ actionButton: (
160
+ <button
161
+ type="button"
162
+ onClick={() => {
163
+ window.alert('click')
164
+ }}>
165
+ ?
166
+ </button>
167
+ ),
168
+ },
168
169
  shrinkLabel: false,
169
170
  value: 38,
170
171
  },