zds-pickers 4.0.15 → 4.0.16

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.
@@ -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>[];
@@ -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
  };
@@ -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
@@ -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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zds-pickers",
3
- "version": "4.0.15",
3
+ "version": "4.0.16",
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
  },